import { px2remOptions, ratio } from './pxtorem'
export const setDomFontSize = () => {
	let fontsize = (document.documentElement.clientHeight || document.body.clientHeight) / 10

	document.querySelectorAll('html')[0].style.fontSize = fontsize + 'px'
}

window.onresize = setDomFontSize

export const resetSize = (size: number | string) => {
	if (typeof size == 'string') {
		return size
	}
	let baseHeight = px2remOptions.rootValue * ratio
	let ratioHeight = size / baseHeight
	let fontsize = (document.documentElement.clientHeight || document.body.clientHeight) * ratioHeight

	return fontsize
}
